<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">

<div class="layui-form-item">
    <label class="layui-form-label label-required-next">设备序列号</label>
    <div class="layui-input-block">
        <input name="sn" value="{$vo.sn|default=''}" required lay-verify="required" placeholder="请输入设备序列号（唯一标识）" class="layui-input">
        <p class="help-block">设备的唯一序列号，用于设备认证</p>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label label-required-next">设备名称</label>
    <div class="layui-input-block">
        <input name="name" value="{$vo.name|default=''}" required lay-verify="required" placeholder="请输入设备名称" class="layui-input">
        <p class="help-block">便于识别的设备名称</p>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label label-required-next">所属门店</label>
    <div class="layui-input-block">
        <select name="store_id" required lay-verify="required">
            <option value="">请选择门店</option>
            {notempty name="stores"}
            {foreach $stores as $sid=>$sname}
            <option value="{$sid}" {if isset($vo.store_id) && $vo.store_id==$sid}selected{/if}>{$sname}</option>
            {/foreach}
            {/notempty}
        </select>
        <p class="help-block">设备所属的门店，决定可访问的会员范围</p>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">设备位置</label>
    <div class="layui-input-block">
        <input name="location" value="{$vo.location|default=''}" placeholder="请输入设备安装位置" class="layui-input">
        <p class="help-block">设备的具体安装位置描述</p>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">设备容量</label>
    <div class="layui-input-block">
        <input name="capacity" value="{$vo.capacity|default='30000'}" type="number" placeholder="设备最大人员容量" class="layui-input">
        <p class="help-block">设备支持的最大人员数量</p>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">设备状态</label>
    <div class="layui-input-block">
        <input type="radio" name="status" value="1" title="启用" {if !isset($vo.status) || $vo.status==1}checked{/if}>
        <input type="radio" name="status" value="0" title="禁用" {if isset($vo.status) && $vo.status==0}checked{/if}>
        <p class="help-block">禁用后设备将无法连接服务器</p>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">备注说明</label>
    <div class="layui-input-block">
        <textarea name="remark" placeholder="请输入备注说明" class="layui-textarea">{$vo.remark|default=''}</textarea>
    </div>
    </div>
</div>

    {if !empty($vo.id)}<input type='hidden' value='{$vo.id}' name='id'>{/if}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type="submit">{empty name='vo.id'}添加设备{else/}保存修改{/empty}</button>
        <button class="layui-btn layui-btn-danger" type="button" data-confirm="确定要取消编辑吗？" data-close>取消</button>
    </div>
</form>
